import { AntdModalProps } from '@/hooks/useAntdModal';
import { saveI18nAppLink } from '@/service/deliver';
import { Form, Input, Modal, message } from 'antd';
import React from 'react';

const SaveModal = ({ modalProps, closeModal, confirmLoading, refresh, form }: AntdModalProps) => {
  const onOk = async () => {
    const data = form.getFieldsValue()
    data.appId = 1
    confirmLoading(true)
    try {
      await saveI18nAppLink(data)
      closeModal()
      message.success('Save success')
      refresh()
    } catch (error) {

    }
    confirmLoading(false)

    
  }
  return (<Modal {...modalProps} onOk={onOk}>
    <Form form={form}>
      <Form.Item hidden name='id' label='系统名称'>
        <Input />
      </Form.Item>
      <Form.Item hidden name='appId' label='系统名称'>
        <Input />
      </Form.Item>
      <Form.Item label='中文名称' name='zhCh' rules={[{ required: true }]}>
        <Input />
      </Form.Item>
      <Form.Item label='英文名称' name='enUs' rules={[{ required: true }]}>
        <Input />
      </Form.Item>
    </Form>
  </Modal>)
}
export default SaveModal